package com.kunpeng.jvsichuanairspider.app;

import com.google.common.collect.Lists;
import com.kunpeng.jvsichuanairspider.bll.Shjmpt;
import com.kunpeng.jvsichuanairspider.entity.VIPInfo;
import com.kunpeng.jvsichuanairspider.bll.CallInterfaceHelper;
import com.kunpeng.jvsichuanairspider.utils.DBUtils;
import com.sun.org.apache.xpath.internal.SourceTree;


import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Administrator on 2017/5/10.
 */
public class VIPMain {

    public static void main(String[] args) {

      /*
       List<VIPInfo> vipInfoList = Lists.newArrayList();
        String regExpress = "([\\u4e00-\\u9fa5]+) (\\d{18}|\\d{17}X)";
        //一共30 * 10 次；
        for(int i = 0; i < 10; i++){
            String getResponse = new CallInterfaceHelper().postMethod("http://shenfenzheng.293.net/", "id=reload...");
            Pattern pattern = Pattern.compile(regExpress);
            Matcher matcher = pattern.matcher(getResponse);
            DBUtils  dbUtils = new DBUtils();
            while(matcher.find()){
                String userName = matcher.group(1);
                String iCNumber = matcher.group(2);
                if((userName != null && userName.trim()!= "") && (iCNumber != null && iCNumber.trim().length() == 18)){
                    VIPInfo vipInfo = new VIPInfo();
                    vipInfo.setUserName(userName);
                    vipInfo.setiCNumber(iCNumber);
                    dbUtils.insertVIPInfo(vipInfo);
                }
            }
        }
        */
        //用正则表达式；



        Shjmpt shjmpt = new Shjmpt();
        //获取token;
        String toekn = shjmpt.getToken("nature521","wuge51874894");
        //String response = shjmpt.getTeamInfo();

        //get http://www.tibetairlines.com.cn/tibetair/pages/newpages/book/book-quickReg.jsp
        String bookResponse = new CallInterfaceHelper().getMethod("http://www.tibetairlines.com.cn/tibetair/pages/newpages/book/book-quickReg.jsp");
        //调这个接口，会有一个图片返回，要获取图片文字；
        String phone = shjmpt.getPhone(1, toekn);
        //调川航官网注册接口；
        System.out.println(phone);
        //调神话接口获得这个电话的验证码；


        System.out.println("Hello world");





    }
}

